home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-03 | 2.1 KB | 74 lines | [TEXT/GEOL] |
- Item forwarded by A33 to A34
-
- Item 1146035 2-Nov-89 12:10
-
- From: D2086 Efficient Field Svc, C Faith,PRT
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: PerformCommand Problems
-
- There is a slight problem with how commit and doit are handled by
- TApplication.PerformCommand.
-
- Specifically, I have a command that can be both Undoable and not Undoable
- depending on exactly what happens in TrackMouse.
-
- Ideally I would like to be able to have the DoIt method set the state of
- fCanUndo to the correct value depending on whether the actions of DoIt are
- undoable or not.
-
- Presently this decision cannot be in DoIt because TApplication.Perform Command
- executes in the order:
-
- saveCmd := command.fCausesChange | command.fCanUndo;
-
- IF saveCmd THEN
- CommitLastCommand;
-
- ......
-
- command.DoIt;
-
- IF saveCmd THEN
- BEGIN
- gLastCommand := command;
- command.fCmdDone := TRUE;
- END;
-
- Hence if fCanUndo is False then even if Doit sets fCanUndo to TRUE:
- gLastCommand is not Set
- command.fCmdDone is not set to TRUE
- CommitLastCommand is not called
-
- because the value of saveCommand is set before DoIt.
-
- Why could saveCommand not be computed after DoIt and CommitLastCommand be
- deferred? Perhaps there is some concern that DoIt relies on the
- previousCommand having been committed? I do not know whether this is a more
- valid generalization than assuming that DoIt will not change fCanUndo.
-
- Is there something wrong with changing fCanUndo in DoIt? (conceptually at
- least, it is wrong now because it does not work)
-
- At the least PerformCommand could check
-
- { CommitLastCommand would have set gLastCommand to NIL if already executed }
- IF gLastCommand <> NIL and command.fCanUndo THEN
- BEGIN
- CommitLastCommand;
- saveCommand := TRUE;
- END;
-
- right after DoIt, this would have the effect of enabling changes in fCanUndo
- while still ensuring that if the last command's state should be committed
- before DoIt it would be. I am not sure that this is even necessary.
-
- Anyone have any thoughts on this?
-
- - Curtis
-
-
-
-
-